var clickDivId='';
var yema=0;


$(document).ready(function(){
    var ClicdId_1=[];
    var temp_1=0;
    var temp1=0;


    // console.log("a")
     $(".left_guidance_Div").click(function(e){
        var div_value=$('#left_guidance').attr("value");
         ClicdId_1[temp_1] = $(e.target).attr('id');
         clickDivId=$(e.target).attr('id');
         // console.log(ClicdId);
         if(temp_1!=0){
             temp_1=0;
         }else{
             temp_1=1;
         }
         //console.log(yema);
         if(yema==0){
             $(".left_all").animate({
                 left:'20px',
                 width:'300px',
             });

             $('#left_all_image').show();
             yema=1;
         }
         else{
             if(ClicdId_1[0]===ClicdId_1[1]){
                 // console.log("同一个");
                 $(".left_all").animate({
                     width:'0',
                     left:'20px',
                 });
                 huanyuan_1();
                 close_allsxt();
                 yema=0;
             }
             else{
                  // console.log("不是同一个");
                 $(".left_all").animate({
                     left:'20px',
                     width:'300px',
                 });


             }
         }
    });
});

function huanyuan_1(){
    $("#Kfdt").hide();
    $("#Dysj").hide();
    $("#Swmx").hide();
    $("#Dxgx").hide();
    $("#Sltc").hide();
    $("#Dzsj").hide();
    $("#Jldb").hide();
    $('#RsAlldata').hide()
    $("#Yxsj").hide();
    $('#left_all_image').hide();
    yema=0;
    ab=0
    $('#left_guidance_Div_1').css('color','rgb(205, 223, 233)');
    $('#left_guidance_Div_2').css('color','rgb(205, 223, 233)');
    $('#left_guidance_Div_3').css('color','rgb(205, 223, 233)');
    $('#left_guidance_Div_4').css('color','rgb(205, 223, 233)');
    $('#left_guidance_Div_6').css('color','rgb(205, 223, 233)');
    $('#left_guidance_Div_7').css('color','rgb(205, 223, 233)');
    $('#left_guidance_Div_8').css('color','rgb(205, 223, 233)');
    $('#left_guidance_Div_5').css('color','rgb(205, 223, 233)');
}

var aa=[0,0,0,0,0,0,0,0];
//1
$(document).ready(function(){
    // var a=0;
    $('#left_guidance_Div_1').click(function (){
        $("#dataselecr_id").hide();
         adata=0
        $("#mytable_list").hide();
        $('#kqdata').val('全部矿区')
        $('#qydata').val('矿区全局')

        if(aa[0]===0){
            $("#Kfdt").show();
            $("#Dysj").hide();
            $("#Swmx").hide();
            $("#Dxgx").hide();
            $("#Sltc").hide();
            $("#Dzsj").hide();
            $("#Jldb").hide();
            $('#RsAlldata').hide()
            ab=0
            $("#Yxsj").hide();
            $('#left_guidance_Div_3').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_2').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_4').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_6').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_7').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_8').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_5').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_1').css('color','rgb(177, 187, 126)');
            aa[0]=1;
            aa[1]=0;
            aa[2]=0;
            aa[3]=0;
            aa[4]=0;
            aa[5]=0;
            aa[6]=0;
            aa[7]=0;

        }else{
            // console.log("a");
            aa[0]=0;
        }
    });
});
//2
$(document).ready(function(){
    // var a=0;
    $('#left_guidance_Div_2').click(function (){

        if (adata==0){
            $("#dataselecr_id").show();
            adata=1
        }else {
            $("#dataselecr_id").hide();
            adata=0
        }

        $("#catname").text('点云数据')
        $("#mytable_list").hide();
        $('#kqdata').val('全部矿区')
        $('#qydata').val('矿区全局')
        if(aa[1]===0){
            $("#Dysj").show();
            $("#Kfdt").hide();
            $("#Swmx").hide();
            $("#Dxgx").hide();
            $("#Sltc").hide();
            $("#Dzsj").hide();
            $("#Jldb").hide();
            $('#RsAlldata').hide()
            ab=0
            $("#Yxsj").hide();
            $('#left_guidance_Div_1').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_3').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_4').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_6').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_7').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_8').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_5').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_2').css('color','rgb(177, 187, 126)');
            aa[1]=1;
            aa[0]=0;
            aa[2]=0;
            aa[3]=0;
            aa[4]=0;
            aa[5]=0;
            aa[6]=0;
            aa[7]=0;
        }else{
            // console.log("a");
            aa[1]=0;
        }
    });
});
//3
$(document).ready(function(){
    // var a=0;
    $('#left_guidance_Div_3').click(function (){
        if (adata==0){
            $("#dataselecr_id").show();
            adata=1
        }else {
            $("#dataselecr_id").hide();
            adata=0
        }

        $("#catname").text('三维模型')
        $("#mytable_list").hide();
        $('#kqdata').val('全部矿区')
        $('#qydata').val('矿区全局')
        if(aa[2]===0){
            $("#Swmx").show();
            $("#Kfdt").hide();
            $("#Dysj").hide();
            $("#Dxgx").hide();
            $("#Sltc").hide();
            $("#Dzsj").hide();
            $("#Jldb").hide();
            $('#RsAlldata').hide()
            ab=0
            $("#Yxsj").hide();
            aa[2]=1;
            aa[0]=0;
            aa[1]=0;
            aa[3]=0;
            aa[4]=0;
            aa[5]=0;
            aa[6]=0;
            aa[7]=0;
            $('#left_guidance_Div_1').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_2').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_4').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_6').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_7').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_8').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_5').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_3').css('color','rgb(177, 187, 126)');
        }else{
            // console.log("a");
            aa[2]=0;
        }
    });
});

$(document).ready(function(){
    // var a=0;
    $('#left_guidance_Div_4').click(function (){
        if (adata==0){
            $("#dataselecr_id").show();
            adata=1
        }else {
            $("#dataselecr_id").hide();
            adata=0
        }

        $("#catname").text('地下管线')
        $("#mytable_list").hide();
        $('#kqdata').val('全部矿区')
        $('#qydata').val('矿区全局')
        if(aa[3]===0){
            $("#Dxgx").show();
            $("#Kfdt").hide();
            $("#Dysj").hide();
            $("#Swmx").hide();
            $("#Sltc").hide();
            $("#Dzsj").hide();
            $("#Jldb").hide();
            $('#RsAlldata').hide()
            ab=0
            $("#Yxsj").hide();
            $('#left_guidance_Div_1').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_2').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_3').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_6').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_7').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_8').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_5').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_4').css('color','rgb(177, 187, 126)');
            aa[3]=1;
            aa[0]=0;
            aa[1]=0;
            aa[2]=0;
            aa[4]=0;
            aa[5]=0;
            aa[6]=0;
            aa[7]=0;
        }else{
            // console.log("a");
            aa[3]=0;
        }
    });
});

$(document).ready(function(){


    // var a=0;
    $('#left_guidance_Div_5').click(function (){

        if (adata==0){
            $("#dataselecr_id").show();
            adata=1
        }else {
            $("#dataselecr_id").hide();
            adata=0
        }

        $("#catname").text('矢量图层')
        $("#mytable_list").hide();
        $('#kqdata').val('全部矿区')
        $('#qydata').val('矿区全局')
        if(aa[4]===0){
            $("#Sltc").show();
            $("#Dxgx").hide();
            $("#Kfdt").hide();
            $("#Dysj").hide();
            $("#Swmx").hide();
            $("#Dzsj").hide();
            $("#Jldb").hide();
            $('#RsAlldata').hide()
            ab=0
            $("#Yxsj").hide();
            $('#left_guidance_Div_1').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_2').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_3').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_4').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_6').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_7').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_8').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_5').css('color','rgb(177, 187, 126)');
            aa[4]=1;
            aa[0]=0;
            aa[1]=0;
            aa[2]=0;
            aa[3]=0;
            aa[5]=0;
            aa[6]=0;
            aa[7]=0;
        }else{
            // console.log("a");
            aa[4]=0;
        }
    });
});

$(document).ready(function(){
    // var a=0;
    $('#left_guidance_Div_6').click(function (){

        if (adata==0){
            $("#dataselecr_id").show();
            adata=1
        }else {
            $("#dataselecr_id").hide();
            adata=0
        }

        $("#catname").text('地质图标数据')
        $("#mytable_list").hide();
        $('#kqdata').val('全部矿区')
        $('#qydata').val('矿区全局')

        if(aa[5]===0){
            $("#Dzsj").show();
            $("#Dxgx").hide();
            $("#Kfdt").hide();
            $("#Dysj").hide();
            $("#Swmx").hide();
            $("#Sltc").hide();
            $("#Jldb").hide();
            $('#RsAlldata').hide()
            ab=0
            $("#Yxsj").hide();
            $('#left_guidance_Div_1').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_2').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_3').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_4').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_5').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_6').css('color','rgb(177, 187, 126)');
            $('#left_guidance_Div_7').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_8').css('color','rgb(205, 223, 233)');
            aa[5]=1;
            aa[0]=0;
            aa[1]=0;
            aa[2]=0;
            aa[3]=0;
            aa[4]=0;
            aa[6]=0;
            aa[7]=0;
        }else{
            // console.log("a");
            aa[5]=0;
        }
    });
});
$(document).ready(function(){
    // var a=0;
    $('#left_guidance_Div_7').click(function (){
        if(aa[6]===0){
            $("#Dzsj").hide();
            $("#Dxgx").hide();
            $("#Kfdt").hide();
            $("#Dysj").hide();
            $("#Swmx").hide();
            $("#Sltc").hide();
            $("#Jldb").show();
            $("#Yxsj").hide();
            $('#left_guidance_Div_1').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_2').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_3').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_4').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_5').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_6').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_8').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_7').css('color','rgb(177, 187, 126)');
            aa[6]=1;
            aa[0]=0;
            aa[1]=0;
            aa[2]=0;
            aa[3]=0;
            aa[4]=0;
            aa[5]=0;
            aa[7]=0;
        }else{
            // console.log("a");
            aa[6]=0;
        }
    });
});
$(document).ready(function(){
    // var a=0;
    $('#left_guidance_Div_8').click(function (){

        if (adata==0){
            $("#dataselecr_id").show();
            adata=1
        }else {
            $("#dataselecr_id").hide();
            adata=0
        }

        $("#catname").text('遥感影像')
        $("#mytable_list").hide();
        $('#kqdata').val('全部矿区')
        $('#qydata').val('矿区全局')

        if(aa[7]===0){
            $("#Dzsj").hide();
            $("#Dxgx").hide();
            $("#Kfdt").hide();
            $("#Dysj").hide();
            $("#Swmx").hide();
            $("#Sltc").hide();
            $("#Jldb").hide();
            $('#RsAlldata').hide()
            ab=0
            $("#Yxsj").show();
            $('#left_guidance_Div_1').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_2').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_3').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_4').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_5').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_6').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_7').css('color','rgb(205, 223, 233)');
            $('#left_guidance_Div_8').css('color','rgb(177, 187, 126)');
            aa[7]=1;
            aa[0]=0;
            aa[1]=0;
            aa[2]=0;
            aa[3]=0;
            aa[4]=0;
            aa[5]=0;
            aa[6]=0;
        }else{
            // console.log("a");
            aa[7]=0;
        }
    });
});


//改变颜色
function change_color(color,e){
    // var div_backgroundColor= getComputedStyle(e).backgroundColor;
    // var div_class= $(e).attr("class");
    // console.log(e)
    // $(document).ready(function() {
    //     $(".Color_div").hide();
    //     document.getElementById(Click_div_id).style.backgroundColor=div_backgroundColor;
    // })
    $(e).parent();
    var a=($(e).parent()).attr("name");
    $(e).css('background-color',color)
    // var li_div=document.getElementById(e).parentElement;
    // var li_name=$(li_div).attr("name");
    //var li_name=($(e).parent()).attr("name");
    var li_name=e
    // var color="\'"+color+"\'";
    // color ="color("+color+")"
    var color11="\'"+color+"\'";
    console.log(color)
    window.tilesets_DWG_Group.forEach((item, index) => {
        if (decodeURIComponent(item.name)==li_name+"_reduce.geojson") {

            setDataSourceColor(item, color);
        }else{
            console.log("s")
        }
    })

    window.tilesets_DY_Group.forEach((item, index) => {
        console.log(li_name)

        if (item.name==li_name) {
            item.style=new Cesium.Cesium3DTileStyle({
                //color: "color('rgba(2,2,2,0.1)')"
                color: "color("+color11+")"
            })
        }else{
            console.log("s")
        }
    })

    window.tilesets_GX_Group.forEach((item, index) => {
        console.log(li_name)
        if (item.name==li_name) {
            item.style=new Cesium.Cesium3DTileStyle({
                //color: "color('rgba(2,2,2,0.1)')"
                color: "color("+color+")"
            })
        }else{
            console.log("s")
        }
    })
}
$(document).ready(function() {
//颜色选择器
    layui.use('colorpicker', function () {
        var colorpicker = layui.colorpicker;
        //渲染
        var a = colorpicker.render({
            elem: '#Sltc_select1',  //绑定元素
            format: 'rgb',
            alpha: true,
            done: function (color) {
                console.log(a.config.elem);
                change_color(color, a.config.elem);
                //譬如你可以在回调中把得到的 color 赋值给表单
            }

        });
        var b = colorpicker.render({
            elem: '#Sltc_select2',  //绑定元素
            //format: 'rgb',
            //alpha: true,
            done: function (color) {
                console.log(color);
                console.log(b);
                change_color(color, b.config.elem);
                //譬如你可以在回调中把得到的 color 赋值给表单
            }

        });
        var c = colorpicker.render({
            elem: '#Sltc_select3',  //绑定元素
            //format: 'rgb',
            //alpha: true,
            done: function (color) {
                console.log(color);
                console.log(c);
                change_color(color, c.config.elem);
                //譬如你可以在回调中把得到的 color 赋值给表单
            }

        });
        var d = colorpicker.render({
            elem: '#Dy_selest1',  //绑定元素
            //format: 'rgb',
            //alpha: true,
            done: function (color) {
                console.log(color);
                console.log(c);
                change_color(color, d.config.elem);
                //譬如你可以在回调中把得到的 color 赋值给表单
            }

        });

        var dy = colorpicker.render({
            elem: '#color_select',  //绑定元素
            //format: 'rgb',
            //alpha: true,
            done: function (color) {
                console.log(color);
                console.log(dy);
                //change_color(color, d.config.elem);
                //譬如你可以在回调中把得到的 color 赋值给表单
            }

        });
        //
        var e = colorpicker.render({
            elem: '#Dy_selest13',  //绑定元素
            //format: 'rgb',
            //alpha: true,
            done: function (color) {
                console.log(color);
                console.log(c);
                change_color(color, e.config.elem);
                //譬如你可以在回调中把得到的 color 赋值给表单
            }

        });

        var f = colorpicker.render({
            elem: '#Dy_selest12',  //绑定元素
            //format: 'rgb',
            //alpha: true,
            done: function (color) {
                console.log(1212,f.config.elem);
                console.log(c);
                change_color(color,f.config.elem);
                //譬如你可以在回调中把得到的 color 赋值给表单
            }

        });
    });
})
function quyuxuanze(e){
    var k=document.getElementById(clickDivId).getAttribute("name")//获取导航栏div索引
    var select_v=$(e).attr("value")//获取点击select的值
    var All_Div=document.getElementsByClassName("left_all_div");//获取classname为left_all_div的全部div
    for(i=0;i<6;i++){
        if (All_Div[i].getAttribute("name").search(select_v) != -1) {
            $(All_Div[k]).show();
        }
        else{
            $(All_Div[k]).hide()
        }
    }
}

let tileset2CollectionGroup = [];
let tileset1CollectionGroup = [];
/**
 * @param {Cesium.Viewer} viewer 控制点
 */
 function split() {

     if ($('#quizz').val()===''||$('#quizy').val()===''){
         layer.msg('左右两侧数据不能为空！');
         return
     }
    $('#RsAlldata').hide()
    console.log('开启卷帘')
    var status=''
    var statustxt=document.getElementById("juanlian").textContent ;
     if(statustxt==='打开卷帘模型对比'){
         status=true
     }else{
         status=false
     }
     //隐藏所有模型
     $('#Iswmx1').prop('checked', false);
     $('#Iswmx2').prop('checked', false);
     try { //隐藏当前所有模型
         window.tilesets_QX_Group.forEach((item, index) => {
             item.show = false
         })
         window.tilesets_DWG_Group.forEach((item, index) => {
             item.show = false
         })
         window.tilesets_DY_Group.forEach((item, index) => {
             item.show = false
         })
         window.tilesets_GX_Group.forEach((item, index) => {
             item.show = false
         })
     }catch (e){
         console.log(e,'模型隐藏log')
     }
    console.log()
    let viewer=window._viewer;
    let mysliderDiv = document.getElementById("slider");
    let myslidersxDiv = document.getElementById("slidersx");
    let leftnumber,rightnumber;
    if ($('#quizz').val()=='2022-07-01-L00251001'){
        leftnumber='0'
    }else if($('#quizz').val()=='2022-07-01-L000swmx1'){
        leftnumber='1'
    }else if($('#quizz').val()=='2022-07-01-L000swmx2'){
        leftnumber='2'
    }else if($('#quizz').val()=='2022-07-01-L000dxgx1'){
        leftnumber='3'
    }else if($('#quizz').val()=='2022-07-01-L000dxgx2'){
        leftnumber='4'
    }else if($('#quizz').val()=='2022-07-01-L000dwg1'){
        leftnumber='5'
    }
    if ($('#quizy').val()=='2022-07-01-L00251001'){
        rightnumber='0'
    }else if($('#quizy').val()=='2022-07-01-L000swmx1'){
        rightnumber='1'
    }else if($('#quizy').val()=='2022-07-01-L000swmx2'){
        rightnumber='2'
    }else if($('#quizy').val()=='2022-07-01-L000dxgx1'){
        rightnumber='3'
    }else if($('#quizy').val()=='2022-07-01-L000dxgx2'){
        rightnumber='4'
    }else if($('#quizy').val()=='2022-07-01-L000dwg1'){
        rightnumber='5'
    }

    //模型左
    var dataLeft=getDataListByValue(leftnumber)
    // console.log(dataLeft)
    //模型右
    var dataRight=getDataListByValue(rightnumber)
    // console.log(dataRight)
    var tileset1Urls=dataLeft[0]
    var code1list=dataLeft[1]
    var tileset2Urls=dataRight[0]
    var code2list=dataRight[1]
    if (status === true) {
        document.getElementById("juanlian").textContent='关闭卷帘模型对比'
        mysliderDiv.style.display = "block";
        for (var i = 0; i < tileset1Urls.length; i++) {
            let options = {
                url: tileset1Urls[i],
                modelMatrix: Cesium.Matrix4.fromArray(code1list[i]),
            };
            let tileslayer = new Cesium.Cesium3DTileset(options);
            let tilesets_QX1 = viewer.scene.primitives.add(tileslayer);
            tilesets_QX1.splitDirection = Cesium.SplitDirection.LEFT; // 只显示在滑动条的左侧，需要右侧显示改为"RIGHT"即可
            tileset1CollectionGroup.push(tileslayer)
        }
        for (var i = 0; i < tileset2Urls.length; i++) {
            let options = {
                url: tileset2Urls[i],
                modelMatrix: Cesium.Matrix4.fromArray(code2list[i]),
            };
            let tileslayer = new Cesium.Cesium3DTileset(options);
            let tilesets_QX2 = viewer.scene.primitives.add(tileslayer);
            tilesets_QX2.splitDirection = Cesium.SplitDirection.RIGHT; // 只显示在滑动条的左侧，需要右侧显示改为"RIGHT"即可
            tileset2CollectionGroup.push(tileslayer)
        }
        // 将滑块的位置与分割位置同步
        let slider = document.getElementById("slider");
        viewer.scene.splitPosition =//确定分割点位置
            slider.offsetLeft / slider.parentElement.offsetWidth;//占据父级容器的比例
        let handler = new Cesium.ScreenSpaceEventHandler(slider);//处理用户输入事件。可以添加自定义功能以在用户输入时执行；参数为任意元素
        let moveActive = false;
        function move(movement) {
            if (!moveActive) {
                return;
            }
            //捕获滑动停止的位置
            let relativeOffset = movement.endPosition.x;
            let splitPosition =
                (slider.offsetLeft + relativeOffset) /
                slider.parentElement.offsetWidth;
            slider.style.left = `${100.0 * splitPosition}%`;
            // console.log(splitPosition)
            viewer.scene.splitPosition = splitPosition;
        }
        //对分割条的操作
        handler.setInputAction(function () {
            moveActive = true;
        }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
        handler.setInputAction(function () {
            moveActive = true;
        }, Cesium.ScreenSpaceEventType.PINCH_START);

        handler.setInputAction(move, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
        handler.setInputAction(move, Cesium.ScreenSpaceEventType.PINCH_MOVE);

        handler.setInputAction(function () {
            moveActive = false;
        }, Cesium.ScreenSpaceEventType.LEFT_UP);
        handler.setInputAction(function () {
            moveActive = false;
        }, Cesium.ScreenSpaceEventType.PINCH_END);
    } else {
        //卸载模型
        try{
            // console.log('清除',tileset1CollectionGroup.length)
            mysliderDiv.style.display = "none";
            myslidersxDiv.style.display = "none";
            document.getElementById("juanlian").textContent = "打开卷帘模型对比";
            for (var i = 0; i < tileset1CollectionGroup.length; i++) {
                // console.log('11111')
                viewer.scene.primitives.remove(tileset1CollectionGroup[i])
            }
            for (var i = 0; i < tileset2CollectionGroup.length; i++) {
                viewer.scene.primitives.remove(tileset2CollectionGroup[i])
            }
        }catch (e) {
            console.log(e)
        }

    }
}

function getDataListByValue(dataValue){
     //倾斜数据*******************
    //模型1
    var tileset1Urls = [
        'http://3510b38g11.zicp.fun:13894/qingxie/moxing1/0101_3dtiles/tileset.json',
        'http://3510b38g11.zicp.fun:13894/qingxie/moxing1/0102_3dtiles/tileset.json',
        'http://3510b38g11.zicp.fun:13894/qingxie/moxing1/0103_3dtiles/tileset.json',
        'http://3510b38g11.zicp.fun:13894/qingxie/moxing1/0104_3dtiles/tileset.json',
        'http://3510b38g11.zicp.fun:13894/qingxie/moxing1/0105_3dtiles/tileset.json'
    ];
    var code1list=[
        [0.999999999999974,4.6629367034256575e-14,2.2962575335627733e-7,0,4.8183679268731794e-14,0.9999999999999147,-4.1253442972788434e-7,0,-2.2962575343954406e-7,4.1253442961686204e-7,0.9999999999998882,0,304.0669335364364,-546.2718233494088,-641.5191934807226,1],
        [0.999999999999974,4.6629367034256575e-14,2.2962575335627733e-7,0,4.8183679268731794e-14,0.9999999999999147,-4.1253442972788434e-7,0,-2.2962575343954406e-7,4.1253442961686204e-7,0.9999999999998882,0,304.0669335364364,-546.2718233494088,-641.5191934807226,1],
        [0.999999999999974,4.6629367034256575e-14,2.2962575335627733e-7,0,4.8183679268731794e-14,0.9999999999999147,-4.1253442972788434e-7,0,-2.2962575343954406e-7,4.1253442961686204e-7,0.9999999999998882,0,304.0669335364364,-546.2718233494088,-641.5191934807226,1],
        [0.999999999999974,4.6629367034256575e-14,2.2962575335627733e-7,0,4.8183679268731794e-14,0.9999999999999147,-4.1253442972788434e-7,0,-2.2962575343954406e-7,4.1253442961686204e-7,0.9999999999998882,0,304.0669335364364,-546.2718233494088,-641.5191934807226,1],
        [0.999999999999974,4.6629367034256575e-14,2.2962575335627733e-7,0,4.8183679268731794e-14,0.9999999999999147,-4.1253442972788434e-7,0,-2.2962575343954406e-7,4.1253442961686204e-7,0.9999999999998882,0,304.0669335364364,-546.2718233494088,-641.5191934807226,1]

    ];
    //模型2
    //加载模型2
    var tileset2Urls = [
        'http://3510b38g11.zicp.fun:13894/qingxie/moxing2/0201_3dtiles/tileset.json',
        'http://3510b38g11.zicp.fun:13894/qingxie/moxing2/0202_3dtiles/tileset.json',
        'http://3510b38g11.zicp.fun:13894/qingxie/moxing2/0203_3dtiles/tileset.json'
    ];
    var code2list=[
        [0.999999999999974,4.6629367034256575e-14,2.2962575335627733e-7,0,4.8183679268731794e-14,0.9999999999999147,-4.1253442972788434e-7,0,-2.2962575343954406e-7,4.1253442961686204e-7,0.9999999999998882,0,304.0669335364364,-546.2718233494088,-641.5191934807226,1],
        [0.999999999999974,4.6629367034256575e-14,2.2962575335627733e-7,0,4.8183679268731794e-14,0.9999999999999147,-4.1253442972788434e-7,0,-2.2962575343954406e-7,4.1253442961686204e-7,0.9999999999998882,0,304.0669335364364,-546.2718233494088,-641.5191934807226,1],
        [0.999999999999974,4.6629367034256575e-14,2.2962575335627733e-7,0,4.8183679268731794e-14,0.9999999999999147,-4.1253442972788434e-7,0,-2.2962575343954406e-7,4.1253442961686204e-7,0.9999999999998882,0,304.0669335364364,-546.2718233494088,-641.5191934807226,1],
    ];
    //点云数据*********************************
    var dyList=['http://3510b38g11.zicp.fun:13894/qingxie/dianyun/8y3dtiles/tileset.json']
    var dycodeList=[[0.999999999999974,4.6629367034256575e-14,2.2962575335627733e-7,0,4.8183679268731794e-14,0.9999999999999147,-4.1253442972788434e-7,0,-2.2962575343954406e-7,4.1253442961686204e-7,0.9999999999998882,0,304.0669335364364,-546.2718233494088,-641.5191934807226,1]]
    //DWG矢量图层数据***********************************
    var dwgList=['http://3510b38g11.zicp.fun:13894/qingxie/dwg/hekuang2/tileset.json']
    var dwgcodeList=[[73.37201643923999,51.69907400870902,-44.08801368038621,0,47.98815268364003,6.5059360717226085,87.49177102929345,0,48.10077344130294,-85.35149994272318,-20.035894087256573,0,-248755990.84566265,435304419.0955888,-393885599.07209444,1]]
    //地下管线图层数据****************************
    var gxList1=['http://3510b38g11.zicp.fun:13894/qingxie/smartminepipeline/red_long/tileset.json']
    var gxCodeList1=[[0.9864398675933796,-0.1302035259989476,0.09991711284758875,0,0.11051854643637493,0.9770485749676759,0.1821036327128731,0,-0.12133440779905415,-0.16859158926552542,0.9781895713577078,0,-4083.017168224789,-3268.634292630013,-2300.52889355924,1]]

    var gxList2=['http://3510b38g11.zicp.fun:13894/qingxie/smartminepipeline/yellow_short/tileset.json']
    var gxCodeList2=[[0.9864398675933796,-0.1302035259989476,0.09991711284758875,0,0.11051854643637493,0.9770485749676759,0.1821036327128731,0,-0.12133440779905415,-0.16859158926552542,0.9781895713577078,0,-4083.017168224789,-3268.634292630013,-2300.52889355924,1]]
    if (dataValue === '0') {
        return [dyList, dycodeList]
    } else if (dataValue === '1') {
        return [tileset1Urls, code1list]
    } else if (dataValue === '2') {
        return [tileset2Urls, code2list]
    } else if (dataValue === '3') {
        return [gxList1, gxCodeList1]
    } else if (dataValue === '4') {
        return [gxList2, gxCodeList2]
    } else if (dataValue === '5') {
        return [dwgList, dwgcodeList]
    }
}

layui.use('element', function(){
    var element = layui.element; //导航的hover效果、二级菜单等功能，需要依赖element模块
    //监听导航点击
    element.on('nav(demo)', function(elem){
        //console.log(elem)
        // layer.msg(elem.text());
        // var elem_div= elem.children();
        // var checked_state =elem_div.children('input').attr('checked');
        // if(checked_state==undefined) {
        //     $(elem_div.children('input')).prop('checked', true);
        // }else{
        //     $(elem_div.children('input')).prop('checked', false);
        // }

        // $('#Iswmx1').prop('checked', false);
        //console.log(elem)
    });
});
//改变底图
function Change_map(e){
    $('#Kfdt a').css('color','rgb(205, 223, 233)');
    var li_name=($(e).parent()).attr("name");
    $(e).css('color','rgb(177, 187, 126)');
    //console.log(li_name);
    if(li_name=='天地图矢量'){
        viewer.imageryLayers._layers[0].show=true;
        viewer.imageryLayers._layers[1].show=false;
        viewer.imageryLayers._layers[2].show=false;
    }else if(li_name=='天地图影像'){
        viewer.imageryLayers._layers[0].show=false;
        viewer.imageryLayers._layers[1].show=true;
        viewer.imageryLayers._layers[2].show=false;
    } else if(li_name=='Esri影像'){
        viewer.imageryLayers._layers[0].show=false;
        viewer.imageryLayers._layers[1].show=false;
        viewer.imageryLayers._layers[2].show=true;
    }
}



